﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Manage/Views/Shared/Master.Master"
    Inherits="System.Web.Mvc.ViewPage<ProductViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <ul class="box">
        <% foreach (EProduct item in Model.ProductList)
           {
        %>
        <li>
            <div class="image">
                <a href="<%=Url.Action("Album",new{productId = item.ProductId}) %>">
                    <img src="<%= Url.Action("thumb", "Home", new { w = 100, h = 130,area="website", s = string.Format("{0}/{1}/{2}", Model.ImageRoot, item.ProductId, item.ImageName) })%>"
                        alt="" />
                </a>
            </div>
            <div class="desc">
                <%= Html.ActionLink(item.ProductName, "Edit", new {productId = item.ProductId })%>
                <br />
                <span>型号:</span>
                <%= item.ProductNo %>
                <br />
                <span>加入时间:</span><%= item.AddDateTime %>
                <br />
                <span>价格:</span><%= item.Price %>
                <span>折扣:</span><%=( item.Price * item.DisCount).ToString("0.00") %>
                <span>折扣率:</span><%=item.DisCount.ToString("0.000")%>
                <br />
                <input type="button" name="btnDelete" value="删除" />
                <%= Html.Hidden("ProductId",item.ProductId) %>
            </div>
        </li>
        <%
           }
        %>
    </ul>
    <div class="divPager2">
        <%= Html.Pager(ViewData["Pager"]) %>
    </div>
    <br />
    <br />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cssLink" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="jsLink" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="cssContent" runat="server">
    <style type="text/css">
        .box
        {
            margin: 20px 20px;
            overflow: hidden;
        }
        .box li
        {
            overflow: hidden;
            padding: 5px;
            border-bottom: 1px dotted #a178b0;
            float: left;
            width: 48%;
        }
        .box .image
        {
            float: left;
        }
        .box .image img
        {
            width: 100px;
            padding: 1px;
        }
        .box .desc
        {
            margin-left: 110px;
            line-height: 1.5;
        }
    </style>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="jsContent" runat="server">
    <script type="text/javascript">
        $(function () {
            $(":button[name='btnDelete']").click(function () {
                var productId = $(this).parent().find(":hidden[name='ProductId']").val();
                if (confirm("删除警告\n确定要删除吗?"))
                    $.post('<%=Url.Action("Delete") %>', { productid: productId }, function () { location.reload(); });
            });
        });
    </script>
</asp:Content>
